home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / vigilant.c < prev    next >
C/C++ Source or Header  |  2000-05-25  |  23KB  |  662 lines

  1. /***************************************************************************
  2.  
  3.   Vigilante
  4.  
  5. If you have any questions about how this driver works, don't hesitate to
  6. ask.  - Mike Balfour (mab22@po.cwru.edu)
  7.  
  8. ***************************************************************************/
  9.  
  10. #include "driver.h"
  11. #include "vidhrdw/generic.h"
  12. #include "sndhrdw/m72.h"
  13.  
  14. /* vidhrdw/vigilant.c */
  15. int vigilant_vh_start(void);
  16. void vigilant_vh_stop(void);
  17. WRITE_HANDLER( vigilant_paletteram_w );
  18. WRITE_HANDLER( vigilant_sprite_paletteram_w );
  19. WRITE_HANDLER( vigilant_horiz_scroll_w );
  20. WRITE_HANDLER( vigilant_rear_horiz_scroll_w );
  21. WRITE_HANDLER( vigilant_rear_color_w );
  22. void vigilant_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  23. void kikcubic_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  24.  
  25.  
  26. WRITE_HANDLER( vigilant_bank_select_w )
  27. {
  28.     int bankaddress;
  29.     unsigned char *RAM = memory_region(REGION_CPU1);
  30.  
  31.     bankaddress = 0x10000 + (data & 0x07) * 0x4000;
  32.     cpu_setbank(1,&RAM[bankaddress]);
  33. }
  34.  
  35. /***************************************************************************
  36.  vigilant_out2_w
  37.  **************************************************************************/
  38. WRITE_HANDLER( vigilant_out2_w )
  39. {
  40.     /* D0 = FILP = Flip screen? */
  41.     /* D1 = COA1 = Coin Counter A? */
  42.     /* D2 = COB1 = Coin Counter B? */
  43.  
  44.     /* The hardware has both coin counters hooked up to a single meter. */
  45.     coin_counter_w(0,data & 0x02);
  46.     coin_counter_w(1,data & 0x04);
  47. }
  48.  
  49. WRITE_HANDLER( kikcubic_coin_w )
  50. {
  51.     /* bits 0 is flip screen */
  52.  
  53.     /* bit 1 is used but unknown */
  54.  
  55.     /* bits 4/5 are coin counters */
  56.     coin_counter_w(0,data & 0x10);
  57.     coin_counter_w(1,data & 0x20);
  58. }
  59.  
  60.  
  61.  
  62. static struct MemoryReadAddress vigilant_readmem[] =
  63. {
  64.     { 0x0000, 0x7fff, MRA_ROM },
  65.     { 0x8000, 0xbfff, MRA_BANK1 },
  66.     { 0xc020, 0xc0df, MRA_RAM },
  67.     { 0xc800, 0xcfff, MRA_RAM },
  68.     { 0xd000, 0xdfff, videoram_r },
  69.     { 0xe000, 0xefff, MRA_RAM },
  70.     { -1 }    /* end of table */
  71. };
  72.  
  73. static struct MemoryWriteAddress vigilant_writemem[] =
  74. {
  75.     { 0x0000, 0xbfff, MWA_ROM },
  76.     { 0xc020, 0xc0df, MWA_RAM, &spriteram, &spriteram_size },
  77.     { 0xc800, 0xcfff, vigilant_paletteram_w, &paletteram },
  78.     { 0xd000, 0xdfff, videoram_w, &videoram, &videoram_size },
  79.     { 0xe000, 0xefff, MWA_RAM },
  80.     { -1 }    /* end of table */
  81. };
  82.  
  83. static struct IOReadPort vigilant_readport[] =
  84. {
  85.     { 0x00, 0x00, input_port_0_r },
  86.     { 0x01, 0x01, input_port_1_r },
  87.     { 0x02, 0x02, input_port_2_r },
  88.     { 0x03, 0x03, input_port_3_r },
  89.     { 0x04, 0x04, input_port_4_r },
  90.     { -1 }    /* end of table */
  91. };
  92.  
  93. static struct IOWritePort vigilant_writeport[] =
  94. {
  95.     { 0x00, 0x00, m72_sound_command_w },  /* SD */
  96.     { 0x01, 0x01, vigilant_out2_w }, /* OUT2 */
  97.     { 0x04, 0x04, vigilant_bank_select_w }, /* PBANK */
  98.     { 0x80, 0x81, vigilant_horiz_scroll_w }, /* HSPL, HSPH */
  99.     { 0x82, 0x83, vigilant_rear_horiz_scroll_w }, /* RHSPL, RHSPH */
  100.     { 0x84, 0x84, vigilant_rear_color_w }, /* RCOD */
  101.     { -1 }    /* end of table */
  102. };
  103.  
  104. static struct MemoryReadAddress kikcubic_readmem[] =
  105. {
  106.     { 0x0000, 0x7fff, MRA_ROM },
  107.     { 0x8000, 0xbfff, MRA_BANK1 },
  108.     { 0xc000, 0xc0ff, MRA_RAM },
  109.     { 0xc800, 0xcaff, MRA_RAM },
  110.     { 0xd000, 0xdfff, videoram_r },
  111.     { 0xe000, 0xffff, MRA_RAM },
  112.     { -1 }    /* end of table */
  113. };
  114.  
  115. static struct MemoryWriteAddress kikcubic_writemem[] =
  116. {
  117.     { 0x0000, 0xbfff, MWA_ROM },
  118.     { 0xc000, 0xc0ff, MWA_RAM, &spriteram, &spriteram_size },
  119.     { 0xc800, 0xcaff, vigilant_paletteram_w, &paletteram },
  120.     { 0xd000, 0xdfff, videoram_w, &videoram, &videoram_size },
  121.     { 0xe000, 0xffff, MWA_RAM },
  122.     { -1 }    /* end of table */
  123. };
  124.  
  125. static struct IOReadPort kikcubic_readport[] =
  126. {
  127.     { 0x00, 0x00, input_port_3_r },
  128.     { 0x01, 0x01, input_port_4_r },
  129.     { 0x02, 0x02, input_port_0_r },
  130.     { 0x03, 0x03, input_port_1_r },
  131.     { 0x04, 0x04, input_port_2_r },
  132.     { -1 }    /* end of table */
  133. };
  134.  
  135. static struct IOWritePort kikcubic_writeport[] =
  136. {
  137.     { 0x00, 0x00, kikcubic_coin_w },    /* also flip screen, and...? */
  138.     { 0x04, 0x04, vigilant_bank_select_w },
  139.     { 0x06, 0x06, m72_sound_command_w },
  140. //    { 0x07, 0x07, IOWP_NOP },    /* ?? */
  141.     { -1 }    /* end of table */
  142. };
  143.  
  144. static struct MemoryReadAddress sound_readmem[] =
  145. {
  146.     { 0x0000, 0xbfff, MRA_ROM },
  147.     { 0xf000, 0xffff, MRA_RAM },
  148.     { -1 }    /* end of table */
  149. };
  150.  
  151. static struct MemoryWriteAddress sound_writemem[] =
  152. {
  153.     { 0x0000, 0xbfff, MWA_ROM },
  154.     { 0xf000, 0xffff, MWA_RAM },
  155.     { -1 }    /* end of table */
  156. };
  157.  
  158. static struct IOReadPort sound_readport[] =
  159. {
  160.     { 0x01, 0x01, YM2151_status_port_0_r },
  161.     { 0x80, 0x80, soundlatch_r },    /* SDRE */
  162.     { 0x84, 0x84, m72_sample_r },    /* S ROM C */
  163.     { -1 }    /* end of table */
  164. };
  165.  
  166. static struct IOWritePort sound_writeport[] =
  167. {
  168.     { 0x00, 0x00, YM2151_register_port_0_w },
  169.     { 0x01, 0x01, YM2151_data_port_0_w },
  170.     { 0x80, 0x81, vigilant_sample_addr_w },    /* STL / STH */
  171.     { 0x82, 0x82, m72_sample_w },            /* COUNT UP */
  172.     { 0x83, 0x83, m72_sound_irq_ack_w },    /* IRQ clear */
  173.     { -1 }    /* end of table */
  174. };
  175.  
  176.  
  177. INPUT_PORTS_START( vigilant )
  178.     PORT_START
  179.     PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_START1 )
  180.     PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_START2 )
  181.     PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_COIN3 )
  182.     PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_COIN1 )
  183.     PORT_BIT(0xF0, IP_ACTIVE_LOW, IPT_UNKNOWN )
  184.  
  185.     PORT_START
  186.     PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
  187.     PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
  188.     PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
  189.     PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
  190.     PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  191.     PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
  192.     PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  193.     PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )
  194.  
  195.     PORT_START
  196.     PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_COCKTAIL )
  197.     PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_COCKTAIL )
  198.     PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_COCKTAIL )
  199.     PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_COCKTAIL )
  200.     PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_COIN2 )
  201.     PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  202.     PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  203.     PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  204.  
  205.     PORT_START
  206.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) )
  207.     PORT_DIPSETTING(    0x02, "2" )
  208.     PORT_DIPSETTING(    0x03, "3" )
  209.     PORT_DIPSETTING(    0x01, "4" )
  210.     PORT_DIPSETTING(    0x00, "5" )
  211.     PORT_DIPNAME( 0x04, 0x04, DEF_STR( Difficulty ) )
  212.     PORT_DIPSETTING(    0x04, "Normal" )
  213.     PORT_DIPSETTING(    0x00, "Hard" )
  214.     PORT_DIPNAME( 0x08, 0x08, "Decrease of Energy" )
  215.     PORT_DIPSETTING(    0x08, "Slow" )
  216.     PORT_DIPSETTING(    0x00, "Fast" )
  217.     /* TODO: support the different settings which happen in Coin Mode 2 */
  218.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
  219.     PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
  220.     PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
  221.     PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
  222.     PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
  223.     PORT_DIPSETTING(    0x10, DEF_STR( 8C_3C ) )
  224.     PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
  225.     PORT_DIPSETTING(    0x20, DEF_STR( 5C_3C ) )
  226.     PORT_DIPSETTING(    0x30, DEF_STR( 3C_2C ) )
  227.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  228.     PORT_DIPSETTING(    0x40, DEF_STR( 2C_3C ) )
  229.     PORT_DIPSETTING(    0x90, DEF_STR( 1C_2C ) )
  230.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  231.     PORT_DIPSETTING(    0x70, DEF_STR( 1C_4C ) )
  232.     PORT_DIPSETTING(    0x60, DEF_STR( 1C_5C ) )
  233.     PORT_DIPSETTING(    0x50, DEF_STR( 1C_6C ) )
  234.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  235.  
  236.     PORT_START
  237.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  238.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  239.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  240.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
  241.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  242.     PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
  243. /* This activates a different coin mode. Look at the dip switch setting schematic */
  244.     PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
  245.     PORT_DIPSETTING(    0x04, "Mode 1" )
  246.     PORT_DIPSETTING(    0x00, "Mode 2" )
  247.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
  248.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  249.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  250.     PORT_DIPNAME( 0x10, 0x10, "Allow Continue" )
  251.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  252.     PORT_DIPSETTING(    0x10, DEF_STR( Yes ) )
  253.     /* In stop mode, press 2 to stop and 1 to restart */
  254.     PORT_BITX   ( 0x20, 0x20, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Stop Mode", IP_KEY_NONE, IP_JOY_NONE )
  255.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  256.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  257.     PORT_BITX(    0x40, 0x40, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
  258.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  259.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  260.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) )
  261.     PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
  262.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  263. INPUT_PORTS_END
  264.  
  265. INPUT_PORTS_START( kikcubic )
  266.     PORT_START
  267.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  268.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY )
  269.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY )
  270.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY )
  271.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  272.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  273.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  274.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 )
  275.  
  276.     PORT_START
  277.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  278.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  279.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN )
  280.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNKNOWN )
  281.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
  282.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
  283.     PORT_BIT_IMPULSE( 0x40, IP_ACTIVE_LOW, IPT_COIN3, 19 )
  284.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
  285.  
  286.     PORT_START
  287.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  288.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_4WAY | IPF_COCKTAIL )
  289.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_4WAY | IPF_COCKTAIL )
  290.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_4WAY | IPF_COCKTAIL )
  291.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  292.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  293.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
  294.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  295.  
  296.     PORT_START
  297.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  298.     PORT_DIPSETTING(    0x02, "Easy" )
  299.     PORT_DIPSETTING(    0x03, "Medium" )
  300.     PORT_DIPSETTING(    0x01, "Hard" )
  301.     PORT_DIPSETTING(    0x00, "Hardest" )
  302.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  303.     PORT_DIPSETTING(    0x08, "1" )
  304.     PORT_DIPSETTING(    0x04, "2" )
  305.     PORT_DIPSETTING(    0x0c, "3" )
  306.     PORT_DIPSETTING(    0x00, "4" )
  307.     /* TODO: support the different settings which happen in Coin Mode 2 */
  308.     PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coinage ) )
  309.     PORT_DIPSETTING(    0xa0, DEF_STR( 6C_1C ) )
  310.     PORT_DIPSETTING(    0xb0, DEF_STR( 5C_1C ) )
  311.     PORT_DIPSETTING(    0xc0, DEF_STR( 4C_1C ) )
  312.     PORT_DIPSETTING(    0xd0, DEF_STR( 3C_1C ) )
  313.     PORT_DIPSETTING(    0xe0, DEF_STR( 2C_1C ) )
  314.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  315.     PORT_DIPSETTING(    0x70, DEF_STR( 1C_2C ) )
  316.     PORT_DIPSETTING(    0x60, DEF_STR( 1C_3C ) )
  317.     PORT_DIPSETTING(    0x50, DEF_STR( 1C_4C ) )
  318.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_5C ) )
  319.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_6C ) )
  320.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  321. //    PORT_DIPSETTING(    0x10, "Undefined" )
  322. //    PORT_DIPSETTING(    0x20, "Undefined" )
  323. //    PORT_DIPSETTING(    0x80, "Undefined" )
  324. //    PORT_DIPSETTING(    0x90, "Undefined" )
  325.  
  326.     PORT_START
  327.     PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) )
  328.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  329.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  330.     PORT_DIPNAME( 0x02, 0x00, DEF_STR( Cabinet ) )
  331.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  332.     PORT_DIPSETTING(    0x02, DEF_STR( Cocktail ) )
  333. /* This activates a different coin mode. Look at the dip switch setting schematic */
  334.     PORT_DIPNAME( 0x04, 0x04, "Coin Mode" )
  335.     PORT_DIPSETTING(    0x04, "Mode 1" )
  336.     PORT_DIPSETTING(    0x00, "Mode 2" )
  337.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Demo_Sounds ) )
  338.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  339.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  340.     PORT_BITX(    0x10, 0x10, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Invulnerability", IP_KEY_NONE, IP_JOY_NONE )
  341.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  342.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  343.     PORT_DIPNAME( 0x20, 0x00, "Level Select" )
  344.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  345.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  346.     PORT_DIPNAME( 0x40, 0x40, "Player Adding" )
  347.     PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
  348.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  349.     PORT_SERVICE( 0x80, IP_ACTIVE_LOW )
  350. INPUT_PORTS_END
  351.  
  352.  
  353.  
  354. static struct GfxLayout text_layout =
  355. {
  356.     8,8, /* tile size */
  357.     4096, /* number of tiles */
  358.     4, /* bits per pixel */
  359.     {64*1024*8,64*1024*8+4,0,4}, /* plane offsets */
  360.     { 0,1,2,3, 64+0,64+1,64+2,64+3 }, /* x offsets */
  361.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, /* y offsets */
  362.     128
  363. };
  364.  
  365. static struct GfxLayout sprite_layout =
  366. {
  367.     16,16,    /* tile size */
  368.     4096,    /* number of sprites ($1000) */
  369.     4,        /* bits per pixel */
  370.     {0x40000*8,0x40000*8+4,0,4}, /* plane offsets */
  371.     { /* x offsets */
  372.         0x00*8+0,0x00*8+1,0x00*8+2,0x00*8+3,
  373.         0x10*8+0,0x10*8+1,0x10*8+2,0x10*8+3,
  374.         0x20*8+0,0x20*8+1,0x20*8+2,0x20*8+3,
  375.         0x30*8+0,0x30*8+1,0x30*8+2,0x30*8+3
  376.     },
  377.     { /* y offsets */
  378.         0x00*8, 0x01*8, 0x02*8, 0x03*8,
  379.         0x04*8, 0x05*8, 0x06*8, 0x07*8,
  380.         0x08*8, 0x09*8, 0x0A*8, 0x0B*8,
  381.         0x0C*8, 0x0D*8, 0x0E*8, 0x0F*8
  382.     },
  383.     0x40*8
  384. };
  385.  
  386. static struct GfxLayout back_layout =
  387. {
  388.     32,1, /* tile size */
  389.     3*512*8, /* number of tiles */
  390.     4, /* bits per pixel */
  391.     {0,2,4,6}, /* plane offsets */
  392.     { 0*8+1, 0*8,  1*8+1, 1*8, 2*8+1, 2*8, 3*8+1, 3*8, 4*8+1, 4*8, 5*8+1, 5*8,
  393.     6*8+1, 6*8, 7*8+1, 7*8, 8*8+1, 8*8, 9*8+1, 9*8, 10*8+1, 10*8, 11*8+1, 11*8,
  394.     12*8+1, 12*8, 13*8+1, 13*8, 14*8+1, 14*8, 15*8+1, 15*8 }, /* x offsets */
  395.     { 0 }, /* y offsets */
  396.     16*8
  397. };
  398.  
  399. static struct GfxDecodeInfo vigilant_gfxdecodeinfo[] =
  400. {
  401.     { REGION_GFX1, 0, &text_layout,   256, 16 },    /* colors 256-511 */
  402.     { REGION_GFX2, 0, &sprite_layout,   0, 16 },    /* colors   0-255 */
  403.     { REGION_GFX3, 0, &back_layout,   512,  2 },    /* actually the background uses colors */
  404.                                                     /* 256-511, but giving it exclusive */
  405.                                                     /* pens we can handle it more easily. */
  406.     { -1 } /* end of array */
  407. };
  408.  
  409. static struct GfxDecodeInfo kikcubic_gfxdecodeinfo[] =
  410. {
  411.     { REGION_GFX1, 0, &text_layout,   0, 16 },
  412.     { REGION_GFX2, 0, &sprite_layout, 0, 16 },
  413.     { -1 } /* end of array */
  414. };
  415.  
  416.  
  417.  
  418. static struct YM2151interface ym2151_interface =
  419. {
  420.     1,            /* 1 chip */
  421.     3579645,    /* 3.579645 MHz */
  422.     { YM3012_VOL(55,MIXER_PAN_LEFT,55,MIXER_PAN_RIGHT) },
  423.     { m72_ym2151_irq_handler },
  424.     { 0 }
  425. };
  426.  
  427. static struct DACinterface dac_interface =
  428. {
  429.     1,
  430.     { 100 }
  431. };
  432.  
  433.  
  434.  
  435. static struct MachineDriver machine_driver_vigilant =
  436. {
  437.     /* basic machine hardware */
  438.     {
  439.         {
  440.             CPU_Z80,
  441.             3579645,           /* 3.579645 MHz */
  442.             vigilant_readmem,vigilant_writemem,vigilant_readport,vigilant_writeport,
  443.             interrupt,1
  444.         },
  445.         {
  446.             CPU_Z80 | CPU_AUDIO_CPU,
  447.             3579645,           /* 3.579645 MHz */
  448.             sound_readmem,sound_writemem,sound_readport,sound_writeport,
  449.             nmi_interrupt,128    /* clocked by V1 */
  450.                                 /* IRQs are generated by main Z80 and YM2151 */
  451.         }
  452.     },
  453.     55, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  454.     1,    /* no need for interleaving */
  455.     m72_init_sound,
  456.  
  457.     /* video hardware */
  458.     64*8, 32*8, { 16*8, (64-16)*8-1, 0*8, 32*8-1 },
  459.     vigilant_gfxdecodeinfo,
  460.     512+32, 512+32,
  461.     0, /* no color prom */
  462.  
  463.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  464.     0,
  465.     vigilant_vh_start,
  466.     vigilant_vh_stop,
  467.     vigilant_vh_screenrefresh,
  468.  
  469.     /* sound hardware */
  470.     SOUND_SUPPORTS_STEREO,0,0,0,
  471.     {
  472.         {
  473.             SOUND_YM2151,
  474.             &ym2151_interface
  475.         },
  476.         {
  477.             SOUND_DAC,
  478.             &dac_interface
  479.         }
  480.     }
  481. };
  482.  
  483. static struct MachineDriver machine_driver_kikcubic =
  484. {
  485.     /* basic machine hardware */
  486.     {
  487.         {
  488.             CPU_Z80,
  489.             3579645,           /* 3.579645 MHz */
  490.             kikcubic_readmem,kikcubic_writemem,kikcubic_readport,kikcubic_writeport,
  491.             interrupt,1
  492.         },
  493.         {
  494.             CPU_Z80 | CPU_AUDIO_CPU,
  495.             3579645,           /* 3.579645 MHz */
  496.             sound_readmem,sound_writemem,sound_readport,sound_writeport,
  497.             nmi_interrupt,128    /* clocked by V1 */
  498.                                 /* IRQs are generated by main Z80 and YM2151 */
  499.         }
  500.     },
  501.     55, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  502.     1,    /* no need for interleaving */
  503.     m72_init_sound,
  504.  
  505.     /* video hardware */
  506.     64*8, 32*8, { 8*8, (64-8)*8-1, 0*8, 32*8-1 },
  507.     kikcubic_gfxdecodeinfo,
  508.     256, 256,
  509.     0, /* no color prom */
  510.  
  511.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE,
  512.     0,
  513.     vigilant_vh_start,
  514.     vigilant_vh_stop,
  515.     kikcubic_vh_screenrefresh,
  516.  
  517.     /* sound hardware */
  518.     SOUND_SUPPORTS_STEREO,0,0,0,
  519.     {
  520.         {
  521.             SOUND_YM2151,
  522.             &ym2151_interface
  523.         },
  524.         {
  525.             SOUND_DAC,
  526.             &dac_interface
  527.         }
  528.     }
  529. };
  530.  
  531.  
  532.  
  533. /***************************************************************************
  534.  
  535.   Game ROMs
  536.  
  537. ***************************************************************************/
  538.  
  539. ROM_START( vigilant )
  540.     ROM_REGION( 0x30000, REGION_CPU1 ) /* 64k for code + 128k for bankswitching */
  541.     ROM_LOAD( "g07_c03.bin",  0x00000, 0x08000, 0x9dcca081 )
  542.     ROM_LOAD( "j07_c04.bin",  0x10000, 0x10000, 0xe0159105 )
  543.     /* 0x20000-0x2ffff empty */
  544.  
  545.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 64k for sound */
  546.     ROM_LOAD( "g05_c02.bin",  0x00000, 0x10000, 0x10582b2d )
  547.  
  548.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  549.     ROM_LOAD( "f05_c08.bin",  0x00000, 0x10000, 0x01579d20 )
  550.     ROM_LOAD( "h05_c09.bin",  0x10000, 0x10000, 0x4f5872f0 )
  551.  
  552.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  553.     ROM_LOAD( "n07_c12.bin",  0x00000, 0x10000, 0x10af8eb2 )
  554.     ROM_LOAD( "k07_c10.bin",  0x10000, 0x10000, 0x9576f304 )
  555.     ROM_LOAD( "o07_c13.bin",  0x20000, 0x10000, 0xb1d9d4dc )
  556.     ROM_LOAD( "l07_c11.bin",  0x30000, 0x10000, 0x4598be4a )
  557.     ROM_LOAD( "t07_c16.bin",  0x40000, 0x10000, 0xf5425e42 )
  558.     ROM_LOAD( "p07_c14.bin",  0x50000, 0x10000, 0xcb50a17c )
  559.     ROM_LOAD( "v07_c17.bin",  0x60000, 0x10000, 0x959ba3c7 )
  560.     ROM_LOAD( "s07_c15.bin",  0x70000, 0x10000, 0x7f2e91c5 )
  561.  
  562.     ROM_REGION( 0x30000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  563.     ROM_LOAD( "d01_c05.bin",  0x00000, 0x10000, 0x81b1ee5c )
  564.     ROM_LOAD( "e01_c06.bin",  0x10000, 0x10000, 0xd0d33673 )
  565.     ROM_LOAD( "f01_c07.bin",  0x20000, 0x10000, 0xaae81695 )
  566.  
  567.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* samples */
  568.     ROM_LOAD( "d04_c01.bin",  0x00000, 0x10000, 0x9b85101d )
  569. ROM_END
  570.  
  571. ROM_START( vigilntu )
  572.     ROM_REGION( 0x30000, REGION_CPU1 ) /* 64k for code + 128k for bankswitching */
  573.     ROM_LOAD( "a-8h",  0x00000, 0x08000, 0x8d15109e )
  574.     ROM_LOAD( "a-8l",  0x10000, 0x10000, 0x7f95799b )
  575.     /* 0x20000-0x2ffff empty */
  576.  
  577.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 64k for sound */
  578.     ROM_LOAD( "g05_c02.bin",  0x00000, 0x10000, 0x10582b2d )
  579.  
  580.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  581.     ROM_LOAD( "f05_c08.bin",  0x00000, 0x10000, 0x01579d20 )
  582.     ROM_LOAD( "h05_c09.bin",  0x10000, 0x10000, 0x4f5872f0 )
  583.  
  584.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  585.     ROM_LOAD( "n07_c12.bin",  0x00000, 0x10000, 0x10af8eb2 )
  586.     ROM_LOAD( "k07_c10.bin",  0x10000, 0x10000, 0x9576f304 )
  587.     ROM_LOAD( "o07_c13.bin",  0x20000, 0x10000, 0xb1d9d4dc )
  588.     ROM_LOAD( "l07_c11.bin",  0x30000, 0x10000, 0x4598be4a )
  589.     ROM_LOAD( "t07_c16.bin",  0x40000, 0x10000, 0xf5425e42 )
  590.     ROM_LOAD( "p07_c14.bin",  0x50000, 0x10000, 0xcb50a17c )
  591.     ROM_LOAD( "v07_c17.bin",  0x60000, 0x10000, 0x959ba3c7 )
  592.     ROM_LOAD( "s07_c15.bin",  0x70000, 0x10000, 0x7f2e91c5 )
  593.  
  594.     ROM_REGION( 0x30000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  595.     ROM_LOAD( "d01_c05.bin",  0x00000, 0x10000, 0x81b1ee5c )
  596.     ROM_LOAD( "e01_c06.bin",  0x10000, 0x10000, 0xd0d33673 )
  597.     ROM_LOAD( "f01_c07.bin",  0x20000, 0x10000, 0xaae81695 )
  598.  
  599.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* samples */
  600.     ROM_LOAD( "d04_c01.bin",  0x00000, 0x10000, 0x9b85101d )
  601. ROM_END
  602.  
  603. ROM_START( vigilntj )
  604.     ROM_REGION( 0x30000, REGION_CPU1 ) /* 64k for code + 128k for bankswitching */
  605.     ROM_LOAD( "vg_a-8h.rom",  0x00000, 0x08000, 0xba848713 )
  606.     ROM_LOAD( "vg_a-8l.rom",  0x10000, 0x10000, 0x3b12b1d8 )
  607.     /* 0x20000-0x2ffff empty */
  608.  
  609.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 64k for sound */
  610.     ROM_LOAD( "g05_c02.bin",  0x00000, 0x10000, 0x10582b2d )
  611.  
  612.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  613.     ROM_LOAD( "f05_c08.bin",  0x00000, 0x10000, 0x01579d20 )
  614.     ROM_LOAD( "h05_c09.bin",  0x10000, 0x10000, 0x4f5872f0 )
  615.  
  616.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  617.     ROM_LOAD( "n07_c12.bin",  0x00000, 0x10000, 0x10af8eb2 )
  618.     ROM_LOAD( "k07_c10.bin",  0x10000, 0x10000, 0x9576f304 )
  619.     ROM_LOAD( "o07_c13.bin",  0x20000, 0x10000, 0xb1d9d4dc )
  620.     ROM_LOAD( "l07_c11.bin",  0x30000, 0x10000, 0x4598be4a )
  621.     ROM_LOAD( "t07_c16.bin",  0x40000, 0x10000, 0xf5425e42 )
  622.     ROM_LOAD( "p07_c14.bin",  0x50000, 0x10000, 0xcb50a17c )
  623.     ROM_LOAD( "v07_c17.bin",  0x60000, 0x10000, 0x959ba3c7 )
  624.     ROM_LOAD( "s07_c15.bin",  0x70000, 0x10000, 0x7f2e91c5 )
  625.  
  626.     ROM_REGION( 0x30000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  627.     ROM_LOAD( "d01_c05.bin",  0x00000, 0x10000, 0x81b1ee5c )
  628.     ROM_LOAD( "e01_c06.bin",  0x10000, 0x10000, 0xd0d33673 )
  629.     ROM_LOAD( "f01_c07.bin",  0x20000, 0x10000, 0xaae81695 )
  630.  
  631.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* samples */
  632.     ROM_LOAD( "d04_c01.bin",  0x00000, 0x10000, 0x9b85101d )
  633. ROM_END
  634.  
  635. ROM_START( kikcubic )
  636.     ROM_REGION( 0x30000, REGION_CPU1 ) /* 64k for code + 128k for bankswitching */
  637.     ROM_LOAD( "mqj-p0",       0x00000, 0x08000, 0x9cef394a )
  638.     ROM_LOAD( "mqj-b0",       0x10000, 0x10000, 0xd9bcf4cd )
  639.     ROM_LOAD( "mqj-b1",       0x20000, 0x10000, 0x54a0abe1 )
  640.  
  641.     ROM_REGION( 0x10000, REGION_CPU2 ) /* 64k for sound */
  642.     ROM_LOAD( "mqj-sp",       0x00000, 0x10000, 0xbbcf3582 )
  643.  
  644.     ROM_REGION( 0x20000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  645.     ROM_LOAD( "mqj-c0",       0x00000, 0x10000, 0x975585c5 )
  646.     ROM_LOAD( "mqj-c1",       0x10000, 0x10000, 0x49d9936d )
  647.  
  648.     ROM_REGION( 0x80000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  649.     ROM_LOAD( "mqj-00",       0x00000, 0x40000, 0x7fb0c58f )
  650.     ROM_LOAD( "mqj-10",       0x40000, 0x40000, 0x3a189205 )
  651.  
  652.     ROM_REGION( 0x10000, REGION_SOUND1 ) /* samples */
  653.     ROM_LOAD( "mqj-v0",       0x00000, 0x10000, 0x54762956 )
  654. ROM_END
  655.  
  656.  
  657.  
  658. GAMEX( 1988, vigilant, 0,        vigilant, vigilant, 0, ROT0, "Irem", "Vigilante (World)", GAME_NO_COCKTAIL )
  659. GAMEX( 1988, vigilntu, vigilant, vigilant, vigilant, 0, ROT0, "Irem (Data East USA license)", "Vigilante (US)", GAME_NO_COCKTAIL )
  660. GAMEX( 1988, vigilntj, vigilant, vigilant, vigilant, 0, ROT0, "Irem", "Vigilante (Japan)", GAME_NO_COCKTAIL )
  661. GAMEX( 1988, kikcubic, 0,        kikcubic, kikcubic, 0, ROT0, "Irem", "Meikyu Jima (Japan)", GAME_NO_COCKTAIL )    /* English title is Kickle Cubicle */
  662.